import { GetUserListApiResponse } from "./userModel";
export interface GetUserListApiParams {
  page: number;
  limit: number;
  username: string;
}

export interface UserItem {
  id: string;
  gmCreate: string;
  username: string;
  nickName: string;
  roleName: string;
}

export type UserList = UserItem[];

export interface GetUserListApiResponse {
  total: number;
  items: UserList;
}

export interface AddUserApiParams
  // 从UserItem类型中挑选一些属性组成一个新类型
  extends Pick<UserItem, "username" | "nickName"> {
  password: string;
}

export interface UpdateUserApiParams extends AddUserApiParams {
  id: string;
}

export interface AddOrUpdateUserFormData extends AddUserApiParams {
  id?: string;
}

export interface RoleItem {
  id: string;
  gmtCreate: string;
  gmtModified: string;
  roleName: string;
}

export type RoleList = RoleItem[];

export interface GetUserRoleListApiResponse {
  allRolesList: RoleList;
  assignRoles: RoleList;
}
